package Day2025_02_22;

public class LeetCode35 {
    public int searchInsert(int[] nums, int target) {
        if (target <= nums[0]) return 0;
        int n = nums.length;
        int left = 0, right = n - 1;
        while (left < right) {
            int mid = left + (right - left + 1) / 2;
            int tmp = nums[mid];
            if (tmp < target) left = mid;
            else right = mid - 1;
        }
        return left + 1;
    }
}
